<template>
  <div class="app-container">
    <!-- Navigation Bar -->
    <el-menu
        :default-active="activeIndex"
        class="nav-menu"
        mode="horizontal"
        background-color="#ffffff"
        text-color="#42b983"
        active-text-color="#42b983"
        @select="handleSelect"
    >
      <el-menu-item index="0" class="logo" @click="sel4">MyPostman接口测试平台</el-menu-item>
      <div class="nav-items">
        <el-menu-item index="1" @click="sel1">工具</el-menu-item>
        <el-menu-item index="2" @click="sel2">在线文档</el-menu-item>
        <el-menu-item index="3" @click="sel3">个人中心</el-menu-item>
        <el-menu-item index="4" @click="sel5">插件</el-menu-item>
      </div>
    </el-menu>

    <!-- Main Content -->
    <div class="main-content">
      <!-- Image Placeholder -->
      <div class="image-container">
        <img
            src="https://pic.imgdb.cn/item/67611a4bd0e0a243d4e51888.png"
            height ="300px"
            width ="300px"
            alt="Feature Image"
            class="feature-image"
        />
      </div>

      <div id="typewriter">
        <h1 >Hi,欢迎来到MyPostman接口测试平台👨‍🎓</h1>
      </div>
      <!-- Headings -->
      <h1 class="main-title">在线接口测试工具</h1>
      <h2 class="subtitle">简化您的开发流程，提高工作效率</h2>
    </div>
    <div class="tag0">
      <HomeComponent/>
    </div>
    <div class="tag1">
      <HomeComponent1/>
    </div>
    <div>
      <IconList/>
    </div>
    <div>
      <MyFoot/>
    </div>
  </div>
</template>

<script>
import HomeComponent from "@/components/HomeComponent.vue";
import HomeComponent1 from "@/components/HomeComponent1.vue";
import IconList from "@/components/IconList.vue";
import MyFoot from "@/components/MyFoot.vue";

export default {
  name: 'NavigationPage',
  data() {
    return {
      activeIndex: '1',
      text: 'Hi 欢迎来到MyPostman接口测试平台！',
      displayedText: '',
      speed: 200, // 打字速度，单位为毫秒
      index: 0
    }
  },
  components:{
    HomeComponent,
    HomeComponent1,
    IconList,
    MyFoot
  },
  methods: {
    handleSelect(key) {
      console.log(`Selected menu item: ${key}`);
    },
    sel1() {
      this.$router.push('/home');
    },
    sel2() {
      this.$router.push('/doc');
    },
    sel3(){
      this.$router.push('/person');
    },
    sel4(){
      this.$router.push('/');
    },
    sel5(){
      this.$router.push('/market');
    }
  },
}
</script>

<style scoped>
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.nav-menu {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo {
  font-size: 1.2rem;
  font-weight: bold;
  color: #42b983 !important;
}

.nav-items {
  display: flex;
}

.main-content {
  margin-top: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
}

.image-container {
  margin: 3rem 0;
  display: flex;
  justify-content: center;
}

.feature-image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.main-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 1rem;
  text-align: center;
}

.subtitle {
  font-size: 1.5rem;
  font-weight: 400;
  color: #606266;
  margin-bottom: 2rem;
  text-align: center;
}

@media (max-width: 768px) {
  .main-title {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1.25rem;
  }

  .nav-menu {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-items {
    width: 100%;
    justify-content: flex-end;
  }
  .tag0{
     margin-top: 100px;
  }
  .tag1{
     margin-top: 30px;
  }
}
</style>